//
//  NewsViewController.m
//  07-HomeWork
//
//  Created by dllo on 16/7/22.
//  Copyright © 2016年 DM.C. All rights reserved.
//

#import "NewsViewController.h"
#import "RegisterViewController.h"

@interface NewsViewController ()

@end

@implementation NewsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"消息列表";
    UIImageView *image = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    image.image = [UIImage imageNamed:@"news"];
    [self.view addSubview:image];
    UIButton *registerButton = [UIButton buttonWithType:UIButtonTypeSystem];
    UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [registerButton setTitle:@"注册" forState:UIControlStateNormal];
    [loginButton setTitle:@"登录" forState:UIControlStateNormal];
    registerButton.backgroundColor = [UIColor colorWithRed:0.118 green:0.651 blue:0.463 alpha:1.000];
    registerButton.titleLabel.font = [UIFont systemFontOfSize:20];
    loginButton.titleLabel.font = [UIFont systemFontOfSize:20];
    registerButton.frame = CGRectMake(82, 400, 250, 50);
    loginButton.frame = CGRectMake(82, 480, 250, 50);
    loginButton.layer.borderWidth = 1;
    loginButton.layer.borderColor = [UIColor lightGrayColor].CGColor;
    registerButton.layer.cornerRadius = 5;
    loginButton.layer.cornerRadius = 5;
    
    [registerButton addTarget:self action:@selector(handleRegisterButton:) forControlEvents:UIControlEventTouchUpInside];
    [loginButton addTarget:self action:@selector(handleLoginButton:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:loginButton];
    [self.view addSubview:registerButton];
}
- (void)handleRegisterButton:(UIButton *)button {
    RegisterViewController *registerView = [[RegisterViewController alloc] init];
    [self.navigationController pushViewController:registerView animated:YES];
}
- (void)handleLoginButton:(UIButton *)button {
    [self dismissViewControllerAnimated:YES completion:nil];
    }
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
